import {Config} from '../../utils/conf.js';
import {httpReq} from '../../utils/http.js';

class list
{
  getList(that,type,offset){
    let obj = {};
    //判断类型
    if(type == 'q'){ //提问页面
      obj.url = Config.uque + wx.getStorageSync("uid");
    }else if(type == 'a'){ //回答页面
      obj.url = Config.uans + wx.getStorageSync("uid");
    }else{ //评论页面
      obj.url = Config.ucom + wx.getStorageSync("uid");
    }
    obj.data = {offset,limit:10}
    httpReq(obj).then(res=>{
      that.setData({
        rows: that.data.rows.concat(res.data.data),
        limit: res.data.data.length + that.data.limit
      })
    })
  }
 
}

export default list;